package com.wiscamp.ninechapters.accounts.infrastructure.mappers;

import com.wiscamp.ninechapters.accounts.infrastructure.po.OrderPaymentPO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;

@Component
public interface OrderPaymentMapper extends JpaRepository<OrderPaymentPO, Long>, JpaSpecificationExecutor<OrderPaymentPO> {

    @Query(value = "select e from OrderPaymentPO e where e.transactionNumber = :transactionNumber")
    OrderPaymentPO getOrderPayment(String transactionNumber);

    @Query(value = "select e from OrderPaymentPO e where e.orderId = :orderId")
    OrderPaymentPO getOrderPayment(long orderId);
}